import java.awt.Container;
import java.awt.Dimension;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.event.MouseEvent;
import java.awt.event.MouseMotionListener;
import java.awt.geom.AffineTransform;
import java.net.URL;

import javax.swing.*;


public class TransformFrame extends JPanel implements MouseMotionListener{
	
	private JFrame f;
	private ImageIcon img;
	
	
	public TransformFrame(){
		setLayout(null);
		addMouseMotionListener(this);
		f = new JFrame("bla");
		f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		f.setPreferredSize(new Dimension(300,300));
		f.setVisible(true);
		
		Container cp = f.getContentPane();
		
		cp.add(this);
		
		img = new ImageIcon(Main.class.getResource("img.png"));
		
		f.pack();
	}
	
	@Override
	public void paintComponent(Graphics g){
		Graphics2D g2 = (Graphics2D) g;
		AffineTransform a = AffineTransform.getTranslateInstance(50, 50);
		a.concatenate(AffineTransform.getRotateInstance(Math.toRadians(45), 16, 16));
		g2.drawImage(img.getImage(),a,this);
	}

	@Override
	public void mouseDragged(MouseEvent arg0) {
		// TODO Auto-generated method stub
		
	}

	@Override
	public void mouseMoved(MouseEvent arg0) {
		System.out.println(arg0.getX()+" "+arg0.getY());
	}
	
	
}
